package cn.hr.service.impl;

import cn.hr.dao.mapper.SysRolePermissionMapper;
import cn.hr.pojo.SysRolePermission;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by MO on 2018/12/25.
 */
@CacheConfig(cacheNames = "rolePermission")
@Scope("prototype")
@Service("rolePermissionService")
public class SysRolePermissionService {
    @Resource
    private SysRolePermissionMapper rolePermissionMapper;

    @Cacheable(keyGenerator = "keyGenerator")
    public List<SysRolePermission> findByRoleId(int roleId) throws Exception {
        return rolePermissionMapper.findByRoleId(roleId);
    }
}
